package Demo25;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-20
 * Time: 21:40
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Fraction a = new Fraction(in.nextInt(), in.nextInt());
        Fraction b = new Fraction(in.nextInt(), in.nextInt());
        System.out.println(a);
        System.out.println(b);
        System.out.println(a.plus(b));
        System.out.println(a.multiply(b).plus(new Fraction(5,6)));
        System.out.println(a);
        System.out.println(b);
        System.out.println(a.toDouble());
        in.close();
    }
}
class Fraction{
    private int a;
    private int b;
    Fraction(int a,int b) {
        if(b<0){
            b=-b;
            a=-a;
        }
        int t =gcd(Math.abs(a),Math.abs(b));
        this.a=a/t;
        this.b=b/t;
    }
    public double toDouble(){
        return (double) a/b;
    }
    public Fraction plus(Fraction r){
        return new Fraction(this.a*r.b+this.b*r.a,this.b*r.b);
    }
    public Fraction multiply(Fraction r){
        return new Fraction(this.a*r.a,this.b*r.b);
    }
    private int gcd(int m,int n){
        while (m%n!=0){
            int temp = m%n;
            m=n;
            n=temp;
        }
        return n;
    }

    @Override
    public String toString() {
        if(a==b)
            return "1";
        return a+"/"+b;
    }
}
/* 请在这里填写答案 */